const STORAGE_KEY = 'mingdu-mp'

module.exports = {
    // 存储
    setItem(key, value, module_name) {
        if (module_name) {
            let module_name_info = this.getItem(module_name)
            module_name_info[key] = value
            wx.setStorageSync(module_name, module_name_info)
        } else {
            wx.setStorageSync(key, value)
        }
    },

    // 获取
    getItem(key, module_name) {
        if (module_name) {
            let val = this.getItem(module_name)
            if (val) return val[key]
            return ''
        } else {
            return wx.getStorageSync(key)
        }
    },

    // 清空特定值 或者 所有值
    clear (key) {
        key ? wx.removeStorageSync(key) : wx.clearStorageSync()
    },

    // 获取系统信息
    getSystemInfo() {
        return wx.getSystemInfoSync()
    }

}
